package com.power.web.action.helpInfo;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.power.Constants;
import com.power.model.helpInfo.TiHelpInfo;
import com.power.model.user.TsSysuser;
import com.power.services.helpInfo.TiHelpInfoService;
import com.power.util.RequestUtil;
import com.power.web.action.base.AbstractBaseAction;

public class TiHelpInfoAction extends AbstractBaseAction {

	private static final long serialVersionUID = 4628301066492657392L;
	private String jsonString;
	@Autowired
	private TiHelpInfoService service;
	private int flag;
	private TiHelpInfo tiHelpInfo;
	private List<TiHelpInfo> tiHelpInfoList;

	public String findInfoList(){
	    try{
		TsSysuser userInfo = (TsSysuser) this.session.get(Constants.USERINFO_KEY);
		tiHelpInfoList = service.findListByMemberId(userInfo.getMemberid());
	    }catch(Exception e){
        }
		return "helpinfoList";
	}
	

	public String delete() {
		this.response.reset();
		this.response.setCharacterEncoding("UTF-8");
		String ids = RequestUtil.getParam(request, "deleteID", "");
		try {
//			service.delete(ids);
			this.response.getWriter().print("{success:true,msg:'删除成功!'}");
		} catch (Exception e) {
			try {
				if ("1".equals(e.getMessage())) {
					this.response.getWriter().print(
							"{success:false,msg:'请先删除省级下面的市级信息,删除失败!'}");
				} else {
					log.error("地区保存失败", e);
					this.response.getWriter().print(
							"{success:false,msg:'删除失败!'}");
				}
			} catch (IOException e1) {
				e1.printStackTrace();
			}
		}
		return null;
	}


	public String getJsonString() {
		return jsonString;
	}

	public void setJsonString(String jsonString) {
		this.jsonString = jsonString;
	}

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }


	public TiHelpInfo getTiHelpInfo() {
		return tiHelpInfo;
	}


	public void setTiHelpInfo(TiHelpInfo tiHelpInfo) {
		this.tiHelpInfo = tiHelpInfo;
	}


	public List<TiHelpInfo> getTiHelpInfoList() {
		return tiHelpInfoList;
	}


	public void setTiHelpInfoList(List<TiHelpInfo> tiHelpInfoList) {
		this.tiHelpInfoList = tiHelpInfoList;
	}

}
